using System;
using System.Reflection;

namespace Microsoft.Practices.Unity.Interception
{
    class MethodReturn : IMethodReturn
    {
        readonly OutputParameterCollection outputs;

        public MethodReturn(object[] arguments,
                            ParameterInfo[] parameters,
                            object returnValue)
        {
            ReturnValue = returnValue;

            Exception = null;
            outputs = new OutputParameterCollection(arguments, parameters);
        }

        public MethodReturn(Exception exception,
                            ParameterInfo[] parameters)
            : this(new object[0], parameters, null)
        {
            Exception = exception;
        }

        public Exception Exception { get; set; }

        public IParameterCollection Outputs
        {
            get { return outputs; }
        }

        public object ReturnValue { get; set; }
    }
}